﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include "NdbObjectSchematic.h"
#include "NdbDataSchema.h"
#include "WallModule.h"
#include "DBUtils.h"

namespace Sample
{
    // 墙体数据类，封装了墙体几何表达所需数据
    class WallData : public gcmp::NdbObjectSchematic
    {
    public:
        DATA_BEGIN(Sample, WallData, gcmp::NdbObjectSchematic, BF444D59 - F50E - 8510 - BF57 - BBE28DDCBA46, WallModule)
            DATA(double, Height)
            DATA(double, Width)
            DATA(gcmp::Vector3d, StartPoint)
            DATA(gcmp::Vector3d, EndPoint)
        DATA_END
    public:
        ~WallData() {};
        double GetHeight() const { return GetHeight__(); };
        double GetWidth() const { return GetWidth__(); };
        gcmp::Vector3d GetStartPoint() const { return GetStartPoint__(); };
        gcmp::Vector3d GetEndPoint() const { return GetEndPoint__(); };

        void SetHeight(double dVal) { SetHeight__(dVal); };
        void SetWidth(double dVal) { SetWidth__(dVal); };
        void SetStart(const gcmp::Vector3d& pt) { SetStartPoint__(pt); };
        void SetEnd(const gcmp::Vector3d& pt);
        // 默认非序列化情况下，由于墙体数据类满足以下两个条件，所以GetTopOwnerObject()返回nullptr
        // 1. WallData仅作为Wall的属性使用
        // 2. 只通过Wall所在的接口对WallData进行修改和设置
        NDB_TOPPARENT_NULL;
    };
}

